public class DeleteNode {
    /**
     *
     * @param head
     * @param val
     * @return
     */
    public ListNode deleteNode(ListNode head, int val) {
        if (head.val == val)
            return head.next;
        ListNode dump = head;
        ListNode next = dump.next;
        while (next!=null){
            if (next.val == val){
                dump.next = next.next;
            }
            dump =dump.next;
            next = next.next;
        }
        return head;


    }
}
